import * as express from 'express';
import { IRoute, Router } from 'express-serve-static-core';
import { getConnection } from "typeorm";
import { Photo } from '../entity/Photo';
let router: Router = express.Router();

/* GET home page. */
router.get('/', function (req, res, next) {
  res.render('index', { title: 'Express' });
});
router.get('/index', function (req, res, next) {
  getConnection().getRepository(Photo).find().then(result => {
    res.send(result);
  });
});

module.exports = router;